﻿using zijian666.DI;

namespace web_demo;

public class Startup
{
    [ConfigureServices]
    public void Swagger(IServiceCollection services)
    {
        // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
        services
            .AddEndpointsApiExplorer()
            .AddSwaggerGen()
            .OnConfigure(provider =>
            {
                var app = provider.GetRequiredService<IApplicationBuilder>();
                var env = provider.GetRequiredService<IWebHostEnvironment>();
                if (env.IsDevelopment())
                {
                    app.UseSwagger();
                    app.UseSwaggerUI();
                }
            });
    }
}
